var verify_agreement_discount_amount_equal = JSON.parse('{"CODE":0, "ACTION":"","LEVEL":"T1", "MSG":"","DATA":"","SCRIPTNAME":"verify_agreement_discount_amount_equal"}');

var detailList = func_agreement_discount_equal(request_sku_list, id, item_nbr, trait_nbr, store_id, retail_start_date, retail_end_date,
    cost_start_date, cost_end_date, active_discount, trait_store, store_type);

if (!isNull(detailList) && detailList.length > 0) {
    var skuIdList = [];
    detailList.forEach(function (itemSku) {
        var compareDiscountAmount = itemSku.discount_amount
        if (discount_amount != compareDiscountAmount) {
            skuIdList.push(itemSku.id);
        }
    })
    if (!isNull(skuIdList)) {
        verify_agreement_discount_amount_equal.CODE = 2;
        verify_agreement_discount_amount_equal.ACTION = 'error';
        verify_agreement_discount_amount_equal.MSG = '与ID=[' + skuIdList.join(',') + ']协议补差金额不相同';
    }
}
JSON.stringify(verify_agreement_discount_amount_equal);